<?php

/**
 * User form base class.
 *
 * @method User getObject() Returns the current form's model object
 *
 * @package    myarticles
 * @subpackage form
 * @author     Apul Gupta<apulmca2k4@gmail.com>
 */
abstract class BaseUserForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'url_slug'         => new sfWidgetFormInputText(),
      'meta_title'       => new sfWidgetFormInputText(),
      'meta_keyword'     => new sfWidgetFormInputText(),
      'meta_description' => new sfWidgetFormInputText(),
      'email_id'         => new sfWidgetFormInputText(),
      'password'         => new sfWidgetFormInputText(),
      'first_name'       => new sfWidgetFormInputText(),
      'last_name'        => new sfWidgetFormInputText(),
      'phone'            => new sfWidgetFormInputText(),
      'fax'              => new sfWidgetFormInputText(),
      'display_name'     => new sfWidgetFormInputText(),
      'address1'         => new sfWidgetFormInputText(),
      'address2'         => new sfWidgetFormInputText(),
      'city'             => new sfWidgetFormInputText(),
      'state'            => new sfWidgetFormInputText(),
      'country'          => new sfWidgetFormInputText(),
      'postal_code'      => new sfWidgetFormInputText(),
      'about_yourself'   => new sfWidgetFormTextarea(),
      'web_url'          => new sfWidgetFormInputText(),
      'photo'            => new sfWidgetFormInputText(),
      'role_id'          => new sfWidgetFormPropelChoice(array('model' => 'Role', 'add_empty' => true)),
      'token'            => new sfWidgetFormInputText(),
      'last_active'      => new sfWidgetFormDateTime(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'is_active'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorPropelChoice(array('model' => 'User', 'column' => 'id', 'required' => false)),
      'url_slug'         => new sfValidatorString(array('max_length' => 200)),
      'meta_title'       => new sfValidatorString(array('max_length' => 200)),
      'meta_keyword'     => new sfValidatorString(array('max_length' => 200)),
      'meta_description' => new sfValidatorString(array('max_length' => 300)),
      'email_id'         => new sfValidatorString(array('max_length' => 100)),
      'password'         => new sfValidatorString(array('max_length' => 50)),
      'first_name'       => new sfValidatorString(array('max_length' => 50)),
      'last_name'        => new sfValidatorString(array('max_length' => 50)),
      'phone'            => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'fax'              => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'display_name'     => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'address1'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'address2'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'city'             => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'state'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'country'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'postal_code'      => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'about_yourself'   => new sfValidatorString(array('required' => false)),
      'web_url'          => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'photo'            => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'role_id'          => new sfValidatorPropelChoice(array('model' => 'Role', 'column' => 'id', 'required' => false)),
      'token'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'last_active'      => new sfValidatorDateTime(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(array('required' => false)),
      'updated_at'       => new sfValidatorDateTime(array('required' => false)),
      'is_active'        => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('user[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'User';
  }


}
